﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AcctrueWMS.Foundation.DAL;
using System.Data;
using System.Text;

using System.Data.SqlClient;
namespace AcctrueWMS.Web.UploadFiles
{
    public partial class uploadFile : System.Web.UI.Page
    {
        public string uploadPage = "";
        public string uploadFileGuid = "";
        public string uploadFileTotalSize = "";
        public string uploadFileSize = "";
        public string uploadFileType = "";
        public string flashPath = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            uploadFileGuid = Request.QueryString["uploadFileGuid"];
            uploadPage = "Upload.aspx?guid=" + uploadFileGuid;
            uploadFileTotalSize = System.Configuration.ConfigurationManager.AppSettings["uploadFileTotalSize"].ToString();
            uploadFileSize = System.Configuration.ConfigurationManager.AppSettings["uploadFileSize"].ToString();
            uploadFileType = System.Configuration.ConfigurationManager.AppSettings["uploadFileType"].ToString();
            if (Request.ApplicationPath != "/")
            {
                flashPath = Request.ApplicationPath;
            }
            flashPath += "/UploadFiles/FlashUpLoad.swf";
            if (Request.QueryString["opt"] == "view")
            {
                rptFileListView.DataSource = FileList();
                rptFileListView.DataBind();
            }
            else
            {
                rptFileList.DataSource = FileList();
                rptFileList.DataBind();
            }
        }

        private DataTable FileList()
        {
            string sSql = "SELECT * FROM sys_attachments WHERE fileID ='" + uploadFileGuid + "'  ORDER BY filePath desc";
            DataTable allTable = null;

            try
            {
                allTable = WMSqlExcuter.ExecuteDataTable(sSql);
            }
            catch (SqlException ex)
            {

                return new DataTable(); 
            }

            return allTable;
        }
    }
}